<!--
  @Descripttion:：职位预览
  @Author：yejianbo
  @Date：2022年07月30日 20:08:25
-->
<!--
    说明：招聘企业-职位详情
 -->
<template>
  <el-drawer
    title="职位预览"
    :visible.sync="drawer"
    size="80%"
    direction="rtl"
  >
    <section class="pc-review-page">
      <!-- 公司基本信息 -->
      <div class="job-info">
        <div class="row1">
          <div class="left">
            <div class="row1-1">
              <span class="title">{{ jobInfo.jobName }}</span>
              <span
                class="strong"
              >{{ jobInfo.lowestSalary || 0 }}-{{
                jobInfo.highestSalary || 0
              }}元/天</span>
              <span
                class="normal"
              >招聘人数：{{ jobInfo.recruitmentCount || 0 }}</span>
              <span
                class="normal"
              >工作语言：{{ jobInfo.jobLanguage || "中文" }}</span>
            </div>

            <div class="row2">
              <span v-if="jobInfo.city">{{ jobInfo.city }}</span>
              <span
                v-if="jobInfo.practicePeriod || jobInfo.workPeriod"
                class="line"
              />
              <span
                v-if="jobInfo.practicePeriod"
              >{{ jobInfo.practicePeriod }}个月</span>
              <span v-if="jobInfo.workPeriod" class="line" />
              <span v-if="jobInfo.workPeriod">{{ jobInfo.workPeriod }}</span>
              <span v-if="jobInfo.education" class="line" />
              <span v-if="jobInfo.education">{{ jobInfo.education }}</span>
              <span v-if="jobInfo.identify" class="line" />
              <span v-if="jobInfo.identify">{{
                ["在校", "应届"][jobInfo.identify]
              }}</span>
            </div>
            <div class="row3">
              <div
                v-for="(item, index) in jobInfo.welfareTags"
                :key="index"
                class="tag"
              >
                {{ item }}
              </div>
            </div>
          </div>
          <div class="right-hire">
            <div class="row1">发布时间：{{ jobInfo.updateTime }}</div>
            <div class="row2">点击量：{{ jobInfo.clickCount }}</div>
          </div>
        </div>
        <div class="row4">
          <img
            v-imgError
            class="logo-img"
            :src="companyInfo.companyLogo"
            alt="logo-img"
          >
          <div class="right-block">
            <div class="name">{{ companyInfo.companyName }}</div>
            <div class="area">{{ companyInfo.industry }}</div>
          </div>
        </div>
      </div>
      <section>
        <!-- 职位描述 -->
        <div class="row-item">
          <div class="title">职位描述</div>
          <div
            v-if="jobInfo.jobDescription"
            class="company-desc"
            v-html="jobInfo.jobDescription.replace(/\n/gm, '<br>')"
          />
        </div>
        <!-- 企业简介 -->
        <div class="row-item">
          <div class="title">{{ jobInfo.companyName }}简介</div>
          <div
            v-if="companyInfo.introduction"
            class="company-desc"
            v-html="companyInfo.introduction.replace(/\n/gm, '<br>')"
          />
          <div class="safe-tips">
            <div class="title">安全提示</div>
            <div class="text">
              数据学徒实习平台严禁用人单位作出任何损害求职者合法权益的违法违规行为，包括单不限于扣押求职者证件，收取求助者财物，向求职者集资，让求职者入股，诱导求职者异地入职，异地参与培训等，您一旦发现此类欣慰，请立即举报
            </div>
            <img
              class="safe-icon"
              src="../../../../assets/images/job/safe.png"
              alt=""
            >
          </div>
        </div>
        <!-- 企业地址 -->
        <div class="row-item">
          <div class="title">企业地址</div>
          <div class="company-address">
            <div class="item">
              <span class="position-icon" />
              {{ jobInfo.workAddress }}
            </div>
          </div>
        </div>
      </section>
    </section>
  </el-drawer>

</template>

<script>
import { getEducationName, getWorkPeriodName } from '../../../../utils/frontDataDict'
import { formatTime } from '../../../../utils/utils'
export default {
  name: 'PcReview',
  components: {
  },
  data() {
    return {
      drawer: false,
      jobInfo: {},
      companyInfo: {}
    }
  },
  mounted() {},
  methods: {
    open(data, companyInfo) {
      try {
        data.education = getEducationName(data.education, true)
      } catch {
        () => {}
      }
      try {
        if (Array.isArray(JSON.parse(data.industry))) {
          data.industry = JSON.parse(data.industry)[1]
        }
        if (Array.isArray(JSON.parse(data.city))) {
          data.city = JSON.parse(data.city)[1]
        }
      } catch {
        () => {}
      }
      try {
        if (Array.isArray(JSON.parse(data.welfareTags))) {
          data.welfareTags = JSON.parse(data.welfareTags)
        }
      } catch {
        () => {}
      }
      data.publishTime &&
        (data.publishTime = formatTime(new Date(data.publishTime)))
      data.workPeriod && (data.workPeriod = getWorkPeriodName(data.workPeriod))
      this.jobInfo = data
      try {
        if (Array.isArray(JSON.parse(companyInfo.companyAddress))) {
          companyInfo.companyAddress = JSON.parse(companyInfo.companyAddress)
        }
      } catch {
        () => {}
      }
      try {
        companyInfo.industry = JSON.parse(companyInfo.industry)
        if (Array.isArray(companyInfo.industry)) {
          companyInfo.industry =
                  companyInfo.industry[companyInfo.industry.length - 1]
        }
      } catch {
        () => {}
      }
      this.companyInfo = companyInfo
      this.drawer = true
    }
  }
}
</script>
<style lang="scss" scoped>
.zzc {
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.3);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 5;
  .box {
    width: 612px;
    height: 435px;
    background: #ffffff;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    box-sizing: border-box;
    padding: 40px;
    padding-bottom: 150px;
    .content {
      width: 100%;
      height: 100%;
      display: flex;
      justify-content: center;
      align-items: center;
      color: #2f8efe;
      font-size: 34px;
      i {
        font-size: 50px;
        margin-right: 5px;
      }
      .link {
        text-decoration: underline;
        cursor: pointer;
      }
      .black {
        color: #37383d;
      }
    }
    .btnRow {
      width: 100%;
      position: absolute;
      height: 70px;
      left: 0;
      bottom: 40px;
      display: flex;
      justify-content: space-between;
      box-sizing: border-box;
      padding: 0 40px;
      .btns {
        width: calc((100% - 20px) / 2);
        cursor: pointer;
        height: 100%;
        font-size: 24px;
        font-weight: 600;
        background-color: #4677b9;
        color: #fff;
        display: flex;
        justify-content: center;
        align-items: center;
        border-radius: 4px;
        &.btnLeft {
          background-color: #fff;
          color: #4677b9;
          border: 1px solid #4677b9;
        }
      }
    }
  }
}
.pc-review-page {
  position: relative;
  background: #fff;

  .job-info {
    position: relative;
    width: 100%;
    background: #f9f9f9;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
    padding: 40px 40px 30px;

    .row1 {
      display: flex;
      flex-flow: row nowrap;
      .left {
        flex: 1;
        .row1-1 {
          margin-bottom: 15px;
          .title {
            font-size: 22px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #37383d;
            line-height: 30px;
            margin-right: 15px;
            vertical-align: bottom;
          }
          .strong {
            font-size: 20px;
            font-family: PingFangSC-Medium, PingFang SC;
            font-weight: 500;
            color: #9597a0;
            line-height: 30px;
            vertical-align: bottom;
            margin-right: 15px;
          }
          .normal {
            font-size: 20px;
            font-family: PingFangSC-Regular, PingFang SC;
            font-weight: 400;
            color: #9597a0;
            line-height: 30px;
            vertical-align: bottom;
            margin-right: 15px;
          }
        }
      }

      .right-hire {
        position: relative;
        width: 135px;
        .row1 {
          font-size: 18px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #9597a0;
          line-height: 24px;
          margin-bottom: 10px;
          text-align: right;
        }

        .row2 {
          font-size: 18px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #9597a0;
          line-height: 24px;
          text-align: right;
        }
      }
    }

    .row2 {
      font-size: 22px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #9597a0;
      line-height: 30px;
      margin-bottom: 21px;

      .line {
        display: inline-block;
        width: 1px;
        height: 14px;
        background: #9ca8be;
        margin: 0 18px;
      }
    }

    .row3 {
      position: relative;
      width: 60%;
      margin-bottom: 30px;

      .tag {
        display: inline-block;
        background: rgba(47, 142, 254, 0.07);
        border-radius: 6px;
        border: 1px solid #2f8efe;
        font-size: 22px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #2f8efe;
        line-height: 44px;
        text-align: center;
        padding: 0 16px;
        margin-right: 20px;
      }
    }

    .row4 {
      position: relative;
      overflow: hidden;

      .logo-img {
        display: block;
        width: 88px;
        height: 88px;
        float: left;
        background: #ffffff;
        border-radius: 8px;
        border: 1px solid #d4d6da;
        margin-right: 25px;
      }

      .right-block {
        position: relative;
        overflow: hidden;
        cursor: pointer;

        .name {
          font-size: 36px;
          font-family: PingFangSC-Semibold, PingFang SC;
          font-weight: 600;
          color: #37383d;
          line-height: 40px;
          margin-bottom: 18px;
        }

        .area {
          font-size: 24px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #9597a0;
          line-height: 22px;
        }
      }
    }

    .right-hire {
      position: relative;
      width: 135px;
      .row1 {
        font-size: 20px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 22px;
        margin-bottom: 15px;
        text-align: right;
      }

      .row2 {
        font-size: 20px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 22px;
        text-align: right;
      }
    }

    .btn {
      display: block;
      padding: 0 30px;
      height: 63px;
      line-height: 63px;
      background: #3d6cb0;
      border-radius: 39px;
      font-size: 26px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #ffffff;
      text-align: center;
      cursor: pointer;

      .edit-icon {
        display: inline-block;
        width: 25px;
        height: 27px;
        margin-right: 18px;
        background: url("../../../../assets/images/edit-icon.png") no-repeat center
          center / cover;
      }

      .send-icon {
        display: inline-block;
        width: 30px;
        height: 25px;
        margin-right: 12px;
        background: url("../../../../assets/images/job/send.png") no-repeat center
          center / cover;
      }
    }

    .edit {
      position: absolute;
      right: 277px;
      bottom: 45px;
      &:hover {
        color: #2f8efe;
        box-shadow: 0px 4px 15px 0px rgba(0, 0, 0, 0.08);
      }
    }

    .send {
      position: absolute;
      right: 35px;
      bottom: 45px;
      &.disabled {
        background: #ccc;
        cursor: not-allowed;
      }
      &:hover {
        color: #2f8efe;
        box-shadow: 0px 4px 15px 0px rgba(0, 0, 0, 0.08);
      }
    }
  }

  .row-item {
    position: relative;
    width: 100%;
    padding: 32px 40px 45px;
    border-bottom: 1px solid #d4d6da;

    &:last-child {
      border-bottom: 1px solid #fff;
    }

    .title {
      position: relative;
      text-align: left;
      font-size: 28px;
      font-family: PingFangSC-Medium, PingFang SC;
      font-weight: 500;
      color: #37383d;
      line-height: 40px;
      margin-bottom: 25px;

      .all {
        position: absolute;
        right: 0;
        bottom: 0;
        font-size: 24px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #2f8efe;
        line-height: 33px;
        vertical-align: bottom;
        cursor: pointer;

        .all-icon {
          display: inline-block;
          width: 32px;
          height: 32px;
          background: url("../../../../assets/images/check_all.png") no-repeat center
            center / cover;
          vertical-align: bottom;
          margin-right: 15px;
        }
      }
    }

    .job-item {
      position: relative;
      background: #ffffff;
      border-radius: 10px;
      border: 1px solid #d4d6da;
      padding: 25px;
      cursor: pointer;

      .job-name {
        font-size: 28px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #37383d;
        line-height: 40px;
        margin-bottom: 35px;

        .salary {
          font-size: 24px;
          font-family: PingFangSC-Regular, PingFang SC;
          font-weight: 400;
          color: #9597a0;
          line-height: 40px;
          float: right;
        }
      }

      .other {
        font-size: 22px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 30px;

        .line {
          position: relative;
          display: inline-block;
          width: 1px;
          height: 14px;
          background: #9597a0;
          margin: 0 18px;
        }
      }
    }

    .company-desc {
      font-size: 24px;
      font-family: PingFangSC-Regular, PingFang SC;
      font-weight: 400;
      color: #9597a0;
      line-height: 38px;
    }

    .company-address {
      position: relative;

      .item {
        font-size: 26px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #37383d;
        margin-top: 35px;
        line-height: 37px;
        cursor: pointer;

        &:first-child {
          margin-top: 0;
        }

        .position-icon {
          display: inline-block;
          width: 24px;
          height: 29px;
          margin-right: 15px;
          background: url("../../../../assets/images/position.png") no-repeat center
            center / cover;
          vertical-align: middle;
        }
      }
    }

    .safe-tips {
      position: relative;
      padding: 30px 269px 20px 20px;
      background: #ffffff;
      border-radius: 10px;
      border: 1px solid #d4d6da;
      margin-top: 40px;

      .title {
        font-size: 28px;
        font-family: PingFangSC-Medium, PingFang SC;
        font-weight: 500;
        color: #2f8efe;
        line-height: 40px;
        margin-bottom: 12px;
      }

      .text {
        font-size: 22px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 38px;
      }

      .safe-icon {
        position: absolute;
        right: 70px;
        top: 50%;
        margin-top: -66px;
        width: 112px;
        height: 112px;
      }
    }

    .contact-row {
      position: relative;
      margin-bottom: 35px;

      .left {
        display: inline-block;
        width: 168px;
        font-size: 24px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #9597a0;
        line-height: 33px;
      }

      .right {
        font-size: 24px;
        font-family: PingFangSC-Regular, PingFang SC;
        font-weight: 400;
        color: #37383d;
        line-height: 33px;
      }
    }
  }
}
::v-deep .el-breadcrumb__inner {
  font-size: 20px;
  font-family: PingFangSC-Regular, PingFang SC;
  font-weight: 400;
  color: #37383d;
  line-height: 28px;
  cursor: pointer;
}
</style>
